-
-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scripts checking #53
Scripts checking #53
Conversation
|
||
</body> | ||
|
||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I put scripts fixtures in fixtures/scripts
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right here is fine. In another PR I will move the files into directories for a cleanup. I'd rather not that happen in this PR as it will make the diff unfairly big. Thanks for asking! ❤️
Looks complete to me. |
end | ||
|
||
def blank? | ||
@content.empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would @content.strip.empty?
be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, I think so, for completeness sake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I think this makes sense. Two questions:
|
|
Ugh, sorry, I promise I know how to computer. I meant <link rel="stylesheet" type="text/css" href="styles.css"> Which is already covered. |
Nokogiri can not distinguish self-closing node from empty one. This element |
You could use regexp for each |
@parkr I can’t figure out how because the node is already parsed: node.to_s == '<script src="./blah.js"></script>' You can add you solution on top of my PR, if you know how. Keep in mind this Stack Overflow answer. @gjtorikian, you said in #30 (comment)
The self-closing check is HTML validation, so we could spare this check. |
add_to_external_urls script.src | ||
else | ||
next if script.ignore? | ||
self.add_issue("internal script #{script.src} does not exist") unless script.exists? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather this be rewritten as:
if script.missing_src?
self.add_issue "script is empty and has no src attribute"
else
next if script.ignore?
if script.remote?
add_to_external_urls script.src
else
self.add_issue("internal script #{script.src} does not exist") unless script.exists?
Rebased. |
WIP
Javascripts are another important source we could check. They behave technically mostly like images, except they can have content. Should I implement more?